//引入 路由组件
const Home = () =>
  import ('@/pages/Home/Home.vue')
const Search = () =>
  import ('@/pages/search')
const Login = () =>
  import ('@/pages/Login')
const Register = () =>
  import ('@/pages/Register')
const Detail = () =>
  import ('@/pages/Detail')
const ShopCart = () =>
  import ('@/pages/ShopCart')
const AddCartSuccess = () =>
  import ('@/pages/AddCartSuccess')


// 配置路由规则
const routes = [{
  path: '/',
  redirect: '/home'
}, {
  name: 'addcartsuccess',
  path: '/addcartsuccess',
  component: AddCartSuccess,
  //foot的显示与隐藏，在home和search 以及 footer页的时候是显示
  meta: { show: true }
}, {
  name: 'shopcart',
  path: '/shopcart',
  component: ShopCart,
  //foot的显示与隐藏，在home和search 以及 footer页的时候是显示
  meta: { show: true }
}, {
  path: '/detail/:skuid',
  component: Detail,
  //foot的显示与隐藏，在home和search 以及 footer页的时候是显示
  meta: { show: true }
}, {
  path: '/home',
  component: Home,
  //foot的显示与隐藏，在home和search页的时候是显示
  meta: { show: true }
}, {
  name: 'search',
  //解决params参数 可传可不传的问题
  path: '/search/:keyword?',
  component: Search,
  meta: { show: true }
}, {
  path: '/login',
  component: Login,
  meta: { show: false }
}, {
  path: '/register',
  component: Register,
  meta: { show: false }
}]

export default routes